/* hooks */
import { useCopy } from '@hooks/useElement'
/* model */
import { COPY_SHARE_ERROR, COPY_SUCCESS } from '@src/model/const/Alert'
/* vue */
import { computed, ComputedRef } from 'vue';

interface PortalShareConfigProps {
  shareLink: string
}

export function usePortalShareConfig(props: PortalShareConfigProps) {
  
  // 分享链接
  const shareLink: ComputedRef<string> = computed(() => props.shareLink || '')
  
  // 点击复制分享链接
  const handleClickCopyShareUrl = () => {
    useCopy(shareLink.value, COPY_SUCCESS, COPY_SHARE_ERROR)
  }
  
  return [handleClickCopyShareUrl]
}